#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<assert.h>
#include<stdlib.h>

void Func1(int N)
{
	int count = 0;
	for (int i = 0;i < N;i++)
	{
		for (int j = 0;j < N;j++)
		{
			++count;
		}
	}

	for (int k = 0;k < 2 * N;++k)
	{
		++count;
	}

	int M = 10;
	while (M--)
	{
		++count;
	}
}

void BubbleSort(int* a, int n)
{
	assert(a);
	for (size_t end = n;end > 0;--end)
	{
		int exchange = 0;
		for (size_t i = 1;1<end;++i) 
		{
		if (a[i - 1] > a[i])
			{
				Swap(&a[i - 1], &a[i]);
				exchange = 1;
			}
		}
		if (exchange == 0)
			break;
	}
}

int BinarySearch(int* a, int n, int x)
{
	assert(a);

	int begin = 0;
	int end = n - 1;

	while (begin <= end)
	{
		int mid = begin + ((end - begin) >> 1);
		if (a[mid] < x)
			begin = mid + 1;
		else if (a[mid] > x)
			end = mid - 1;
		else
			return mid;
	}
}

int main()
{

}

long long Fac(size_t N)
{
	if (0 == N)
		return 1;
	return Fac(N - 1) * N;
}

long long* Fibonacci(size_t n)
{
	if (n == 0)
		return NULL;
	long long* fibArray = (long long*)malloc((n + 1) * sizeof(long long));
	fibArray[0] = 0;
	fibArray[1] = 1;
	for (int i = 2;i < n;i++)
	{
		fibArray[i] = fibArray[i] + fibArray[i - 2];
	}

	return fibArray;
}